<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/views/include/taglib.jsp" %>
	<c:set var="getCommentURL" scope="page" value="${pageContext.request.contextPath}/comment/getComment/${commentType}/${resourceId}.html"></c:set>
	<c:set var="commentResourceURL" scope="page" value="${pageContext.request.contextPath}/comment/commentResource/${commentType}/${resourceId}.html"></c:set>
	<c:set var="commentAgreeURL" scope="page" value="${pageContext.request.contextPath}/comment/${commentType}/vote/AGREE/${resourceId}.html"></c:set>
	<c:set var="commentDisagreeURL" scope="page" value="${pageContext.request.contextPath}/comment/${commentType}/vote/DISAGREE/${resourceId}.html"></c:set>
	<c:set var="commentDeleteURL" scope="page" value="${pageContext.request.contextPath}/comment/${commentType}/delete.html"></c:set>
	
	<c:set var="loginedUserId" scope="page" value="0"></c:set>
	<skyline:setSessionAttrToVar var="user" key="SESSION_USER"/>
	<c:choose>
		<c:when test="${user!=null}">
			<c:set var="loginedUserId" scope="page" value="${user.id}"></c:set>
		</c:when>
	</c:choose>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/comment.js"></script>
	<script type="text/javascript">	
		var comment=new Comment();
		comment.resourceId=${resourceId};
		comment.type="${commentType}";
		comment.loginedUserId=${loginedUserId};
		comment.ownerId=${ownerId};
		
		comment.commentResourceURL="${commentResourceURL}";
		comment.agreeURL="${commentAgreeURL}";
		comment.disagreeURL="${commentDisagreeURL}";
		comment.deleteURL="${commentDeleteURL}";
		comment.getLoginedUserURL="${pageContext.request.contextPath}/getlogineduser.html";
		//comment.ajaxloginURL="${pageContext.request.contextPath}/ajaxlogin.html";
		
		var smileys=["angel_smile","angry_smile","broken_heart","confused_smile","cry_smile","devil_smile","embaressed_smile"];
		var smileysChn=["天使","生气","心碎","迷惑","哭泣","恶魔","尴尬"];
		
		var smileysPath="${pageContext.request.contextPath}/plugin/ckeditor/plugins/smiley/images/";
		var portraitPath="${pageContext.request.contextPath}/image/";
		var sorryGifPath="${pageContext.request.contextPath}/img/commons/sorry_small.gif"
	</script>
	<link href="${pageContext.request.contextPath}/css/comment.css" rel="stylesheet" type="text/css"/>
	<link href="${pageContext.request.contextPath}/css/base.css" rel="stylesheet" type="text/css"/>
	
	<skyline:ajaxPage firstFunc="firstFunc" pageKey="page" objId="commentAjax"
		url="${getCommentURL}" pageDivId="pageDiv,pageDiv2" successFunc="comment.processData"
		maxSize="5" errorFunc="comment.doError" arcCur="false" curClass="cur1 cur2"
		curStyle="font-size:14px" decStr="%s" normalClass="a_pagination"
		normalStyle="font-size:14px"/>
	
	<script type="text/javascript">
	jQuery("document").ready(function(){
		commentAjax.firstFunc();
	});
	</script>
		
	
	<table width="640" cellspacing="0" cellpadding="0" height="28" style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word;">
		<tr bgcolor="#f2b600">
			<td><font id="commentnum" color="#ffffff"></font></td>
			<td align="right"><a id="a_hideOrShowComments"
				class="a_hideOrShowComments" href="#" onclick="comment.hideOrShowComments()">-</a>&nbsp;</td>
		</tr>
	</table>
	<div id="pageDiv" style="width: 640px" align="right" ></div>
	<table id="commentlist" width="640" cellspacing="0" cellpadding="0" style="FONT-SIZE: 14px;LINE-HEIGHT: 16pt ;table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word;"></table>
	<br>
	<div id="pageDiv2" style="width: 640px" align="right" ></div>
	<c:choose>
		<c:when test="${user==null}">
				<!-- <a id="loginA" href="javascript:showLoginDiv()">您还未登陆</a>
				<div id="loginDiv" style="display:none">
					&nbsp;E-mail:<input type="text" name="emial" id="email"  class="Input"  >
					&nbsp;Password:<input type="password" name="password" id="password"  class="Input" >
					&nbsp;<input  class="btn_ok" type="button" value="登陆" onclick="login()">&nbsp;
				</div> -->
		</c:when>
		<c:otherwise>
		<div id="myCommentDiv"><font id="commentFont" color="red"></font>
		<div id="refCommentInfo" style="display: none"><b>&nbsp; <font
			id="refCommentInfoFont" color="#004e90"></font></b> <font
			id="refCommentCommetidFont" style="display: none">0</font> <a
			title="取消回复" href="javascript:comment.cancelRefComment()"><img
			style="border: 0px" alt="取消回复"
			src="${pageContext.request.contextPath}/img/commons/fail_min.gif"></a></div>
		<div>
		<table
			style="table-layout: fixed; WORD-BREAK: break-all; WORD-WRAP: break-word;">
			<tr>
				<td width='100' valign='top' align='center'>
				<div id="loginedUserDiv"
					style="table-layout: fixed; WORD-BREAK: break-all; WORD-WRAP: break-word; width: 100px;">
				</div>
				</td>
				<td align="right" valign='top'><textarea id="myComment"
					cols="60" rows="4" onfocus="comment.showTools()"></textarea>
				<div id="tools" style="display: none"><a
					href="javascript:comment.insertSmiley()">不能打开表情工具包</a></div>
				</td>
			</tr>
		</table>
		</div>
		<div align="right" style="width: 640px"><br>
		<input class="btn_ok" type="button"
			onclick="comment.commentResource()" value="提交">&nbsp; <input
			class="btn_cancel" type="button" onclick="comment.cancelComment()"
			value="取消">&nbsp;</div>
		</div>
	</c:otherwise>
	</c:choose>
	<script type="text/javascript">
	comment.getLoginedUser();
	</script>
	